# 时间复杂度是 O(n)，呈线性增长，如果数据量巨大，速度会越拖越慢
def fib_loop_for(n):
    a, b = 0, 1
    for _ in range(n):
        a, b = b, a + b
    return a

def fib_loop_while(n):
    a, b = 1, 1
    while n > 0:
        a, b = b, a + b
        n -= 1
    return a

for i in range(20):
    print(fib_loop_for(i), end=' ')
